﻿using System;
using System.Net;
using System.IO;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace AudioEffectBox
{
    public class MyAudioSink : AudioSink
    {
        public MyAudioSink(Stream outputStream)
        {
            if (outputStream == null) throw new ArgumentException("Output stream must not be null");
            if (!outputStream.CanWrite) throw new ArgumentException("Output stream must be writeable");
            OutPut = outputStream;
        }
        public Stream OutPut { get; private set; }

        protected override void OnCaptureStarted()
        {
            //do nothing
        }

        protected override void OnCaptureStopped()
        {
            //do nothing
        }

        protected override void OnFormatChange(AudioFormat audioFormat)
        {
            
        }

        protected override void OnSamples(long sampleTimeInHundredNanoseconds, long sampleDurationInHundredNanoseconds, byte[] sampleData)
        {
            OutPut.Write(sampleData, 0, sampleData.Length);
        }
    }
}
